const router = require('koa-router')();
const fileUtils = require('../../util/fileUtils');

router.prefix('api/wx/file');

/**
 * @api {post} /api/wx/file/upload 上传文件
 * @apiGroup Upload
 * @apiName Upload
 * @apiParam {String} token
 * @apiParam {File} file 文件
 * @apiSuccess {String} file_path 文件的路径
 */

router.post('/upload', fileUtils.single('file'), async (ctx) => {
    ctx.body = {code: 1, msg: '上传成功', data: {file_path: '/' + ctx.req.file.filename}};
});
module.exports = router;